<?php
/**
 * Cart_AdminController
 * 
 * @author
 * @version 
 */

class Log_SettingsController extends Zen_Controller_Admin 
{
	public function indexAction() 
	{
		$file=APPLICATION_PATH."/modules/log/settings/log.ini";
		$values = new Zend_Config_Ini($file);
		$values = $values->toArray();
		
		$form = new Log_Form_Settings ();
		$form->setDefaults ( $values );
		
		if ($this->_request->isPost ()) {
			if ($form->isValid ( $this->_getAllParams () )) {
				$config=new Zend_Config($form->getValues());
				$writer=new Zend_Config_Writer_Ini();
				$writer->write($file,$config);
				$this->_helper->FlashMessenger->setNamespace ( 'messages' )->addMessage ( array ('text' => 'Изменения сохранены', 'type' => 'alert' ) );
				$this->_redirect ( $_SERVER ['REQUEST_URI'] );
			}
		}
		$this->view->form = $form;
	}
}